//
//  UIFont+Extension.swift
//  Swift-Categary
//
//  Created by lantaiyuan on 2017/9/11.
//  Copyright © 2017年 lantaiyuan. All rights reserved.
//

import Foundation
import UIKit

extension UIFont {
   //设置全部机型
    class func fontOfSize(_ size:CGFloat) ->UIFont {
    
      return systemFont(ofSize: size)
    }
    
    //区分机型
    class func fontOfSize(_ is4sOr5s:CGFloat,other:CGFloat) ->UIFont {
        if isIphone4 || isIPhone5 {
            return fontOfSize(is4sOr5s)
        }
       return fontOfSize(other)
    }
    
    //区分机型设置
    class func fontOfSize(_ is4sOr5s:CGFloat,iphone6:CGFloat,iphone6P:CGFloat) ->UIFont {
        if isIphone4 || isIPhone5 {
            return fontOfSize(is4sOr5s)
        }else if isIPhone6 {
          return fontOfSize(iphone6)
        }
           return fontOfSize(iphone6P)
    }
    
    //BoldSystem 设置全部机型
    class func boldFontOfSize(_ size:CGFloat) ->UIFont{
        return boldSystemFont(ofSize: size)
    }
    //BoldSystem 区分机型设置
    class func boldFontOfSize(_ is4sOr5s:CGFloat,other:CGFloat) ->UIFont {
        if isIphone4 || isIPhone5 {
            return boldFontOfSize(is4sOr5s)
        }
        return boldFontOfSize(other)
    }
    
    //BoldSystem区分机型设置
    class func boldFontOfSize(_ is4sOr5s:CGFloat,iphone6:CGFloat,iphone6P:CGFloat) ->UIFont {
        if isIphone4 || isIPhone5 {
            return boldFontOfSize(is4sOr5s)
        }else if isIPhone6 {
            return boldFontOfSize(iphone6)
        }
        return boldFontOfSize(iphone6P)
    }
    
    ///MARK Custom Font
    //customFont 设置全部机型
    class func fontOfNameSize(_ fontName:String,size:CGFloat) ->UIFont {
       return UIFont.init(name: fontName, size: size)!
    }
    
    //custom 区分机型设置 4 5 || 6 6p
    class func fontOfNameSize(_ fontName:String,is4sOr5s:CGFloat,other:CGFloat) ->UIFont {
    
        if isIphone4 || isIPhone5 {
            return fontOfNameSize(fontName, size: is4sOr5s)
        }
        return fontOfNameSize(fontName, size: other)
    }
    //custom 区分机型设置 4 5 || 6 ||6p
    class func fontOfNameSize(_ fontName:String,is4sOr5s:CGFloat,iphone6:CGFloat,iphone6P:CGFloat) ->UIFont {
        
        if isIphone4 || isIPhone5 {
            return fontOfNameSize(fontName, size: is4sOr5s)
        }else if isIPhone6 {
            return fontOfNameSize(fontName, size: iphone6)
        }
        return fontOfNameSize(fontName, size: iphone6P)
    }
}
